CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(MESHPOTATO)

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
SET(Boost_NEEDED_LIBS filesystem
                      python
                      thread
                      system
                      )


FIND_PACKAGE(Doxygen)
FIND_PACKAGE(FFTW REQUIRED)
FIND_PACKAGE(GLEW REQUIRED)
FIND_PACKAGE(GLUT REQUIRED)
FIND_PACKAGE(Half REQUIRED)
FIND_PACKAGE(OpenEXR REQUIRED)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(OpenImageIO REQUIRED)
FIND_PACKAGE(OpenVDB REQUIRED)
FIND_PACKAGE(PythonLIBS)
FIND_PACKAGE(TBB REQUIRED)
FIND_PACKAGE(Alembic)
FIND_PACKAGE(Boost COMPONENTS ${Boost_NEEDED_LIBS} REQUIRED)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
  ${GLEW_INCLUDE_PATH}
  ${OPENGL_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
  ${OPENVDB_INCLUDE_DIRS}
  ${OPENVDB_INCLUDE_PYTHON_DIRS}
  ${Boost_INCLUDE_DIRS}
  ${OPENEXR_INCLUDE_DIRS}
  ${HALF_INCLUDE_DIRS}
  ${OPENIMAGEIO_INCLUDE_DIRS}
  ${TBB_INCLUDE_DIRS}
  ${PYTHON_INCLUDE_PATH}
  ${FFTW_INCLUDES}
  )


ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(bin)
ADD_SUBDIRECTORY(lib)
ADD_SUBDIRECTORY(python)
ADD_SUBDIRECTORY(pymeshpotato)
ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(meshviewer)

IF( DOXYGEN_FOUND)
  CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/docs/Doxyfile.in ${PROJECT_BINARY_DIR}/Doxyfile @ONLY)
  ADD_CUSTOM_TARGET( doc ALL ${DOXYGEN_EXECUTABLE} ${PROJECT_BINARY_DIR}/Doxyfile
    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
    COMMENT "Generating API documentation with Doxygen" VERBATIM)
  INSTALL(DIRECTORY ${PROJECT_BINARY_DIR}/docs DESTINATION ${CMAKE_INSTALL_PREFIX})
ENDIF()

INCLUDE(CPack)
